package psi

import (
	"fmt"
	"strings"
)

/*
SOS 短信报警开关
平台发送:
[DW*YYYYYYYYYYYYYYY*LEN*SOSSMS,0 或 1]
实例:[DW*334588000000156*0008*SOSSMS,0]
终端回复:
[DW*YYYYYYYYYYYYYYY*LEN*SOSSMS]
实例:[DW*334588000000156*0006*SOSSMS]
说明: 设置产生 SOS 报警后是否向 SOS 号码发送短信(0:关闭,1:打开
*/

// SOS 短信报警开关
type SOSSMS struct {
	Switch int // 0 或 1
}

func DealSOSSMS(method string, params map[string]interface{}) (string, error) {
	var sosms SOSSMS
	err := MapToStruct(params, &sosms)
	if err != nil {
		return "", err
	}
	var messageList []string
	messageList = append(messageList, "SOSSMS")
	messageList = append(messageList, fmt.Sprint(sosms.Switch))
	message := strings.Join(messageList, ",")
	return message, nil
}
